home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 5⁄11⁄90 / 1269-Solution Tabbing bet-May90 < prev    next >
Encoding:
Text File  |  1990-05-11  |  2.0 KB  |  64 lines  |  [TEXT/GEOL]

  1. Item    9295388                         9-May-90        10:33PDT
  2.  
  3. From:   D4684                           Robins Analytics, S Robins,PRT
  4.  
  5. To:     STRONG.S                        Strong, Steve
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    Solution: Tabbing between…
  10.  
  11. Steve,
  12.     I have solved the tabbing between fields bug in Dialog views. This is
  13. probably old news but I've included it any how since I am probably not the only
  14. person in the world who never got around to fixing it.
  15.     The problem was that in my dialogs I have fields that have different
  16. maximum number of characters. When you try to tab from a field that has 2
  17. characters max to one that has 3 characters it would fail if the 3 char field
  18. was full because the fMaxChars field isn't set yet before the SetText. The
  19. number of characters it is trying to set is greater that what it thinks is its
  20. max. The solution was simple. I just set the variable before calling SetText in
  21. TDialogTEView.InstallEditText. It works fine now.
  22.  
  23. IN TTEView.StuffText:
  24.    It would fail here since fMaxChars is still set to the last fields value not
  25. the one we are tabbing to.
  26.  
  27.    IF textLength > fMaxChars THEN
  28.    BEGIN
  29.    {$IFC qDebug}
  30.    ProgramBreak('Text size exceeds maximum for this view');
  31.    {$ENDC}
  32.    Failure(minErr, 0); { ??? Assign a message }
  33.    END;
  34.  
  35. The solution in TDialogTEView.InstallEditText:
  36. BEFORE:
  37.    theEditText.GetText(theText);
  38.    SetText(theText);
  39.    RecalcText;
  40.    IF selectChars THEN
  41.    SetSelect(0, MAXINT, fHTE)
  42.    ELSE
  43.    SetSelect(0, 0, fHTE);  { Caller will set the selection. }
  44.    fMaxChars := theEditText.fMaxChars;
  45.  
  46. AFTER:
  47.    fMaxChars := theEditText.fMaxChars;
  48.    theEditText.GetText(theText);
  49.    SetText(theText);
  50.    RecalcText;
  51.    IF selectChars THEN
  52.    SetSelect(0, MAXINT, fHTE)
  53.    ELSE
  54.    SetSelect(0, 0, fHTE);  { Caller will set the selection. }
  55.  
  56.    Once again, I would like to declare my love for THINK 3.0. Lightsbug is
  57. AWESOME. It makes things like this so easy to find.
  58.  
  59. Good Luck,
  60. Doug Ahmann
  61. Robins Analytics
  62. St. Paul, MN
  63.  
  64.